<template>
        <div>
            <form action="/">
              <van-search
                  v-model="value"
                  show-action
                  placeholder="请输入搜索关键词"
                  @search="onSearch"
                  @cancel="onCancel"
              />
            </form>
          <div v-if="list.length>0">
            <p v-for="(item,index) in list" :key="index"
            class="tost"
               @click="sear(item.id)"
            >{{item.name}}</p>
          </div>
            <div v-else>
              <van-empty image="search" description="没有搜索到数据哦" />
            </div>
        </div>
</template>

<script>
import {searItem} from '@/utils/http'
export default {
  data() {
    return {
      value:this.$route.query.name,
      list:this.$route.query.res,
    };
  },
  mounted() {
      //console.log(this.$route.query.res)
  },
  methods: {
    onSearch(val) {

    },
    onCancel() {
     this.$router.push('/point')
    },
    sear(id){
      console.log(id)
        searItem(id).then(res=>{
          //console.log(res)
        })
    }
  },
};
</script>

<style scoped>
.tost{
  width: 100%;
  height: 26px;
  font-size: 12px;
  border-bottom: 1px solid gainsboro;
  text-align: center;
  line-height: 26px;
}
</style>